<?php
header("Content-Type:text/html;charset=utf-8");//防止中文乱码
//第一步：连接数据库，指定数据库
$db=new mysqli("localhost","root","","db_bbs","3306");
   if ($db->connect_error)
   {
       die("连接失败，原因".$db->connect_error);
   }
   $db->query ('set names utf8');